/*

    tools23d - tools for converting images to 3D formats.
    Copyright (C) 2014  Dave Gorst

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef IMAGE_FREEIMAGE_H_INCLUDED
#define IMAGE_FREEIMAGE_H_INCLUDED

#if ((FREEIMAGE_MAJOR_VERSION >= 3) && (FREEIMAGE_MINOR_VERSION >= 14))
	#define HAVE_FIF_LOAD_NO_PIXELS
#endif

#define IMAGE_FORMAT FREE_IMAGE_FORMAT
#define IMAGE_FORMAT_UNKNOWN FIF_UNKNOWN

typedef unsigned int image_index;

void T3D_InitialiseBackend (void);
void T3D_ShutdownBackend (void);

void T3D_ImageErrorHandler(IMAGE_FORMAT, const char *);
BOOL T3D_RetrievePictureDetails (char *, IMAGE_FORMAT *, unsigned int *, unsigned int *, unsigned int *);
IMAGE_FORMAT T3D_RetrievePictureType (char *);
void T3D_SetActiveFilter (Filters);

BOOL T3D_CreateImage (unsigned int *, unsigned int, unsigned int, unsigned int);
BOOL T3D_LoadImage (unsigned int *, char *);
void T3D_DestroyImage (image_index);
BOOL T3D_ScaleImage (unsigned int *, unsigned int, unsigned int);
BOOL T3D_CropImage (image_index *, unsigned int, unsigned int, unsigned int, unsigned int);
BOOL T3D_CopyInto (image_index, image_index, unsigned int, unsigned int);
BOOL T3D_ColourConvert (image_index *, ColourScheme);
BOOL T3D_WriteImageToFile (image_index, char *);

/* Internal functions */
FIBITMAP ** T3D_AddImageToList (void);


#endif
